Skip to content

[4.22] Prevent unmanaging VM from CloudStack if it is part of a CKS cluster#12800

Open
nvazquez wants to merge 3 commits intoapache:4.22from
shapeblue:422-fix-cks-node-unmanage-vm
Open

[4.22] Prevent unmanaging VM from CloudStack if it is part of a CKS cluster#12800
nvazquez wants to merge 3 commits intoapache:4.22from
shapeblue:422-fix-cks-node-unmanage-vm

Conversation

@nvazquez
Copy link
Contributor

Description

This PR prevents unmanaging a VM from CloudStack if it belongs to a CKS cluster

Fixes: #12783

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.61%. Comparing base (09ee092) to head (49bc5e8).

Files with missing lines Patch % Lines
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 50.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #12800   +/-   ##
=========================================
  Coverage     17.61%   17.61%           
- Complexity    15661    15667    +6     
=========================================
  Files          5917     5917           
  Lines        531423   531433   +10     
  Branches      64973    64975    +2     
=========================================
+ Hits          93586    93597   +11     
+ Misses       427280   427279    -1     
  Partials      10557    10557           
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 18.68% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kiranchavala kiranchavala self-assigned this Mar 12, 2026
Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17119

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15632)

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15633)

@kiranchavala
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 17156

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17157

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15671)

@nvazquez
Copy link
Contributor Author

@blueorangutan test keepEnv

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15672)

@nvazquez nvazquez force-pushed the 422-fix-cks-node-unmanage-vm branch from 8935377 to ac7a0fe Compare March 16, 2026 18:27
@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17160

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15677)

@nvazquez
Copy link
Contributor Author

@blueorangutan test keepEnv

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15678)

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17168

@kiranchavala
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@kiranchavala a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Copy link
Member

@kiranchavala kiranchavala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nvazquez Please provide proper error message when a end user unamanges a instance which is a part of a cks cluster

Image
(localcloud) 🐱 > unmanage virtualmachine id=0aa8147a-1002-49e9-bcc6-5af4b35f05d2
{
  "account": "admin",
  "accountid": "7f089b6c-21c6-11f1-92f3-1e004e000380",
  "cmd": "org.apache.cloudstack.api.command.admin.vm.UnmanageVMInstanceCmd",
  "completed": "2026-03-17T07:33:20+0000",
  "created": "2026-03-17T07:33:20+0000",
  "domainid": "28ca91c8-21c6-11f1-92f3-1e004e000380",
  "domainpath": "ROOT",
  "jobid": "59a56976-d640-419b-b135-86706c5fee19",
  "jobinstanceid": "0aa8147a-1002-49e9-bcc6-5af4b35f05d2",
  "jobinstancetype": "VirtualMachine",
  "jobprocstatus": 0,
  "jobresult": {
    "errorcode": 530,
    "errortext": "No bean named 'com.cloud.kubernetes.cluster.KubernetesServiceHelper' available"
  },
  "jobresultcode": 530,
  "jobresulttype": "object",
  "jobstatus": 2,
  "userid": "7f09fbfa-21c6-11f1-92f3-1e004e000380"
}
🙈 Error: async API failed for job 59a56976-d640-419b-b135-86706c5fee19

The message can be similar to the one when a end user tries to destroy a machine which is part of the cks cluster

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

CKS cluster goes into alert state when worker node is unmanaged

5 participants